﻿using System;
using System.Windows;
using System.Linq.Expressions;

namespace HelpersDotNet.Extensions
{
    public static partial class Extensions
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="R"></typeparam>
        /// <param name="obj"></param>
        /// <param name="expression"></param>
        /// <returns></returns>
        /// <remarks>http://blogs.microsoft.co.il/blogs/dorony/archive/2007/08.aspx</remarks>
        public static string GetPropertySymbol<T, R>(this T obj, Expression<Func<T, R>> expression)
        {
            return ((MemberExpression)expression.Body).Member.Name;
        }
    }
}